<?php

defined('SYSPATH') or die('No direct script access.');

class Controller_Base_Backend extends Controller_Admin {

    private $adm_root;

    public function __construct(Request $request, Response $response) {

        parent::__construct($request, $response);

        $this->view = Smarty_View::factory('base/html.tpl');
        $this->view->js = array(
            "jquery" => array(
                "type" => "text/javascript",
                "src" => DOC_ROOT . "modules/pandrade/static/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js",
            ),
            "jquery-ui" => array(
                "type" => "text/javascript",
                "src" => DOC_ROOT . "modules/pandrade/static/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js",
            ),
//                    "jquery-ui-datepicker-pt-BR"=> array(
//                            "type"=>"text/javascript",
//                            "src"=>DOC_ROOT."modules/pandrade/static/jscript/jquery.ui.datepicker-pt-BR.js",
//                            ),
            "general" => array(
                "type" => "text/javascript",
                "src" => DOC_ROOT . "modules/pandrade/static/jscript/general.js",
            ),
        );
        $this->view->css = array(
            "jquery-ui" => array(
                "rel" => "stylesheet",
                "href" => DOC_ROOT . "modules/pandrade/static/jquery-ui-1.10.3.custom/css/ui-lightness/jquery-ui-1.10.3.custom.min.css",
                "type" => "text/css",
                "media" => "screen",
                "charset" => "utf-8",
            ),
            "general" => array(
                "rel" => "stylesheet",
                "href" => DOC_ROOT . "modules/pandrade/static/css/general.css",
                "type" => "text/css",
                "media" => "screen",
                "charset" => "utf-8",
            ),
            "backend" => array(
                "rel" => "stylesheet",
                "href" => DOC_ROOT . "modules/pandrade/static/css/backend.css",
                "type" => "text/css",
                "media" => "screen",
                "charset" => "utf-8",
            ),
        );
        $this->view->meta = array();
        $this->view->meta[] = array("http-equiv" => "Content-Type", "content" => "text/html;charset=UTF-8");

        $this->view->body = Smarty_View::factory('base/body_backend.tpl');
        if (isset(Kohana::$config->load('pandrade')->google_key) && !empty(Kohana::$config->load('pandrade')->google_key)) {
            $this->view->body->google_key = Kohana::$config->load('pandrade')->google_key;
        }

        $this->view->title = Kohana::$config->load('pandrade')->adm_root . " - " . Kohana::$config->load('pandrade')->sys_name;
        $this->view->body->top = Smarty_View::factory('adm/top.tpl');
        $this->view->body->login = PandradeAuth::backend();
        $this->view->body->footer = Arr::get(Kohana::modules(), "i18nUrl") ? (Views::Language(($redirect = substr(Request::current()->uri(), 6)) == "adm/home/index" ? 'adm/' : $redirect)) : "Default Footer";
        if (Kohana::$profiling)
            $this->view->body->profile = View::factory('profiler/stats');
    }

}

// End Backend